EbsScript mainly helps in an automatic processing of the data stored in Ebsilon. It is not possible to change the topology of the model with EbsScript. This must be done with the graphical Editor.
However, in certain cases it is helpful to be able to access the topology functions from EbsScript. For instance, in order to access the values of the connected pipes from a component, one must know, which pipe is connected where. This is enabled by special topology functions (in this case getPipeAtLink), which are described in the chapter on Default value functions.
However, there is a simplified syntax, with which one can access the connections. Nesting is also possible here.
Syntax |
Description |
Example |
compname._i |
Connection at Pin i |
Generator._2.Q Electrical generator power |
compname.__i |
Component at the other end of the connection at Pin i |
Steam generator.__2.ETAI Efficiency |
pipename._in |
Component at the inlet of the pipe |
Electro._in.ETAG Generator efficiency |
pipename._out |
Component at the outlet of the pipe |
L_Main steam._out.ETAI Efficiency HP-Turbine |
comp.__[port number] | access to next component (NOT a line, which is connected via a line to connection "port number". | turbine.__6 returns the component connected to the shaft output of the turbine. |
comp.__[port number]d | Access to next component or line connected by a line to connection "port number" | transmitter.__1d returns the object connected to the input of the value transmitter |
comp.__[port number]p | access to next line (NOT a component), which is connected by a line to connection "port number" | controller.__3p returns the line connected to the controller's "corrected value" output |
pipe._in and ._out | access next component (NOT a pipe) which is connected to the inlet or outlet of the pipe | water._in returns the component connected to the inlet of the water pipe |
pipe._ind and ._outd | access next component or pipe connected to the pipe inlet/outlet | logic._ind returns the object connected to the logic pipe inlet |
pipe._inp and ._outp | access next pipe (NOT a component) associated with the pipe's entry or exit. | scheduled._inp returns the pipe pointed to by the scheduled pipe |
The EbsScript function getLogicObj() can be used to access value crosses, components like 45, 46 etc. and other logic lines docking to a line.
Accordingly, other attributes of the objects of a model (components, lines, macros, value crosses, text fields, OLE object, graphic elements, etc.) can also be accessed - some properties are not available for all object types:
Syntax |
Description |
Data type |
Example |
absoluteName | Complete object name | String | "::Getriebe::Rechner" |
alignHorz | Horizontal alignment | TextAlignmentHorizontalEnum | T.alignHorz := TextAlignmentHorizontalRight; |
alignVert | Vertical alignment | TextAlignmentVerticalEnum | T.alignVert := TextAlignmentVerticalCenter; |
alwaysDIN | Representation according to DIN, classical stream types, some components | Boolean | T.alwaysDIN := false; |
calcstatus | Calculation status 0: Component deactivated, : Component is calculated, 2: Component deactivated, but taken into account for outputs | Integer | T.calcstatus := 0,1,2; |
calcresultsatiterationstep | rue: Result calculation also after each iteration step | CalculateResultsAtIterationStepEnum | T.calcresultsatiterationstep := CalculateResultsAtIterationStepOnlyLastOne; |
calculationFPROG | ID of the user-defined sub-programme (see default value FPROG) | Integer | KernelScripting, see components 65 und 93 |
calculationKernelScript | Text of the kernel script created for the component | String | T.KernelScript := "begin end;"; |
calculationKernelScriptAuxiliaryCalls | KernelScript specific auxiliary calls | ComponentCalculationKernelScriptAuxiliaryCallsEnum | T.ComponentCalculationKernelScriptAuxiliaryCall := ComponentCalculationKernelScriptAuxiliaryCallsNo; |
calculationKernelScriptGenerateDefaultEquations | KernelScript specific: Generate standard equations automatically | ComponentCalculationKernelScriptGenerateDefaultEquationsEnum | T.ComponentCalculationKernelScriptGenerateDefaultEquations := ComponentCalculationKernelScriptGenerateDefaultEquationsYes; |
calculationMode | Calculation mode of a component: Standard, XUI-DLL, KernelScripting |
ComponentCalculationModeEnum | T.ComponentCalculationMode := ComponentCalculationModeInternal: |
calculationSequence | Default value FSEQ of some components, KernelScripting, XUI-DLL | ComponentCalculationSequenceEnum | T.ComponentCalculationSequence := TestLib_AreIntegersEqual_AndExit (T.calculationSequence, ComponentCalculationSequenceParallelToOtherComponents; |
color | Filling colour of the components (standard: yellow) | Integer | T.color := $2068FF; // orange |
color2 | Alternating colour of a stream | Integer | T.color2 := $FF0000; // blue |
color3 | unused | Integer | T.color3 := $0000FF; // red |
color4 | Colour of the rim one component (standard black) | Integer | T.color4 := $D0E040; // light blue |
containerMacro | The macro in which a component is contained | ebsmacro |
println (Getriebe.containerMacro); |
currentPicture | Index of the image used to display an object | integer | T.currentPicture := 0, 1, 2... ; |
description | Description text | String | Messwert.description:="T hinter HD-VW 5"; |
description2 |
Description text2 (e. g. Leittechnik-Kennung) |
String | Messwert.description2:="I0005"; |
description3 | Description text3 (e. g. Verwendungsbereich) | String |
Messwert.description3:="Kessel"; |
description4 | Description text4 (e. g. Kennzeichen) | String | Messwert.description4:="X"; |
disableEbsScriptEvaluation | Deactivate the execution of EbsScripts in text fields - the script text is then output. | Boolean | Textfeld.disableEbsScriptEvaluation := true; |
drawBodyStyle | Display standard graphic and/or picture | DrawBodyStyleEnum | T.DrawBodyStyle := DrawBodyStyleDefaultAndPicture; |
fontAutoScale | Adjust object and/or font size - or no adjustment | Integer | Getriebe::Rechner.fontAutoScale := 2; |
fontCol | Font colour | Integer | T.fontcol := $480048; // Purpur |
fontName | Name of the font | String | println (T.fontName); |
fontPointSize | Size of the font in points | Integer | T.fontPointSize := 14; |
fontSize | Size of the font | Integer | T.fontSize := -18; |
fullName | Full name of the object | String | "Getriebe::Rechner" |
htmlAutoResize | For HTML texts: automatic resizing so that the text is displayed in full | Boolean | Text.htmlAutoResize := true; |
htmlCSS | The CSS of the HTML text field | String | Text.htmlCSS:= "h1 {color:mediumseagreen; font-weight:bold; font-size:28pt}"; |
htmlSyntax | Output text unprocessed (false) or interpreted as HTML (true) | Boolean | Text.htmlSyntax := true; |
name | Name of the object | String | "Rechner" |
parentObject | The associated parent object (for macros) | ebsobject | println (Getriebe::Rechner.parentObject); |
pictureCount | Number of images assigned to an object | Integer | println (Getriebe.pictureCount); |
shape | The shape of the component with which it is displayed | Integer | T.shape := 4; |
shapeCount | Number of available shapes of a component | Integer | println (Getriebe::Kondensator.shapeCount); |
sortString | Sort string for the internal calculation kernel object sequence | String | T.sortString := "bb"; |
text | The text that was entered in the text field. | String | println (Text.text); --> {getfilename()} |
textEvaluated | The text that is displayed in a text field. | String | println (Text.textEvaluated); -->AllProperties.ebs |
textDependsOnProfile | true: different texts in profiles possible | Boolean | Text.textDependsOnProfile := true; |
textFromParentProfile | true: The text from the parent profile is displayed | Boolean | Text.textFromParentProfile := false; |
transientState | transient calculation: This one time-dependent default value provides the component results of all time-dependent default values of this component at the end of a time step as start values for the next time step. | String | println (Getriebe::Kondensator.transientState); |
visible | Visibility of the object | Integer |
Messwert.visible:=false; // unsichtbar schalten |
width | Width of a stream | Integer | T._1.width := 4; // Leitung an Anschluss 1 auf Breite 4 setzen |
The use of this syntax is possible with Ebsvar constants (direct use of the names of the corresponding object in the model) as well as with Ebsvar variables (variables defined in the EbsScript, which point to the objects in the model). Example:
If there is a pipe with the name H2O_DAMPF_4 in the model and ePipe is declared in EbsScript
var ePipe:ebsPipe;
then after the assignment
ePipe:=H2O_DAMPF_4;
the pressure on this line can be accessed with
epipe.p
as well as with
H2O_DAMPF_4.p